﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace AzureDriverExplorer_Client
{
    public class Const
    {
        
        //
        public static string _Directory = "Directory";
        //ポイント
        public static char PontChar = '.';
        //バイト数
        public static long MaxBit = 655360;
        //TreeViewのサイズ
        public static int TreeIcoSize = 22;
        //ListViewのサイズ
        public static int ListIcoSize = 30;
        //Default Icon
        public static String DefaultIco = "Image/ImageList/images.png";
        //Read Only Icon
        public static String IcoOnlyRead = "Image/ImageList/images_onlyRead.png";
        //Folder ico
        public static String IcoFolder = "Image/TreeView/CloseFolder.ico";
        //Read Only Icon
        public static String IcoRename = "Image/rename_file.png";        
        //設定
        public static string FileConfig = "AccauntConfig.config";

        public static string key()
        {
            string key = string.Empty;

            string customSetting = ConfigurationManager.AppSettings["Credential"].ToString();
            if (null != customSetting)
                key = customSetting;

            return key;
        }

        public static string keyLanguage()
        {
            string key = "0";

            string customSetting = ConfigurationManager.AppSettings["Language"].ToString();
            if (null != customSetting)
                key = customSetting;

            return key;
        }
    
        public string Language
        {
            get
            {
                string key = string.Empty;
                string customSetting = "0";
                try
                {
                    customSetting = ConfigurationManager.AppSettings["Language"].ToString();
                }
                catch {
                    ConfigurationManager.AppSettings["Language"] = customSetting;
                }
                if (null != customSetting)
                    key = customSetting;

                if (key.Equals(null) || key.Equals("0"))
                    key = "_E";
                if (key.Equals("1"))
                    key = "_J";
                if (key.Equals("2"))
                    key = "_S";

                return key;
            }
            set
            {
                string key = string.Empty;
                ConfigurationManager.AppSettings["Language"] = value;                
            }

        }


        private static string UpColor_0 = "White";
        private static string UpColor_30 = "#FFD1FFD1";
        private static string UpColor_60 = "#FF96FF96";
        private static string UpColor_80 = "#FF48FF48";
        private static string UpColor_100 = "Lime";
        private static string UpColor_Error = "#FFDD0E0E";
        private static string UpColor_Cancel = "Yellow";
        
        

        public static string upColor(int progress)
        {
            string color = UpColor_0;
            if (progress >= 0 && progress <= 30)
                color = UpColor_0;
            else if (progress >= 30 && progress <= 60)
                color = UpColor_30;
            else if (progress >= 60 && progress <= 80)
                color = UpColor_60;
            else if (progress >= 80 && progress <= 99)
                color = UpColor_80;
            else if (progress == 100)
                color = UpColor_100;
            else if (progress == 101)
                    color = UpColor_Error;
            else if (progress == 102)
                color = UpColor_Cancel;

            return color;
        }

    }

}
